<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>商品管理</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('Mall/add')}">新增商品</a>
        </div>

        <!-- 高级搜索 -->
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
    <table class="">
    <thead>
        <tr>
        <th class="">商品编号</th>
        <th class="">商品名称</th>
        <th class="">兑换积分</th>
        <th class="">价格（元）</th>
        <th class="">上架时间</th>
        <th class="">操作</th>
        </tr>
    </thead>
    <tbody>
    <notempty name="_list">
    <volist name="_list" id="vo">
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.name}</td>
            <td>{$vo.integral}</td>
            <td>{$vo.money}</td>
            <td>{$vo.createtime|date='Y-m-d',###}</td>
            <td>
                <a href="{:U('Mall/edit?id='.$vo['id'])}">编辑</a>
                <eq name="vo.isshow" value="1">
                    <a href="{:U('Mall/changeStatus?method=down&id='.$vo['id'])}" class="ajax-get" style="color: #ff0000">下架</a>
                    <else/>
                    <a href="{:U('Mall/changeStatus?method=up&id='.$vo['id'])}" class="ajax-get" style="color: #0000ff">上架</a>
                </eq>
            </td>
        </tr>
    </volist>
    <else/>
    <td colspan="9" class="text-center"> aOh! 暂时还没用户! </td>
    </notempty>
    </tbody>
    </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
    //搜索功能
    $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
        window.location.href = url;
    });
    //回车搜索
    $(".search-input").keyup(function(e){
        if(e.keyCode === 13){
            $("#search").click();
            return false;
        }
    });
    //导航高亮
    highlight_subnav('{:U('User/index')}');
    </script>
</block>
